from alipay.aop.api.DefaultAlipayClient import DefaultAlipayClient
from alipay.aop.api.AlipayClientConfig import AlipayClientConfig

# 应用ID
APPID = "2016101600698164"
# 网关
GETWAT = "https://openapi.alipaydev.com/gateway.do"
# 应用公钥
APP_PUBLIC_KEY = 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAhos5X4QkuPNVazwuWjvBtgdWAaauZ+jzAmB2w9ly+Uul+O3AMsmKuhx1fB3QkKJIh98yD0yMDSqUwD9ehikkGZ2cIN9zqJCW1ODsRev/vrtz6Dpy2EF4RgdRRpk3r4f0miFlqv9lHinmMUuvFUe3MgnbN0bCwA08BfOReVretKmBiZti3P9ZARv5NETuLtBW0+2pqF5g3h4yzXSdifaTFmO+pBMorKCL9Zs46MmmHqENH8TtasiJmWxwYWub0nMSZwvyIGoXVsfpF5J9OWYZUYh8JqWFQ4LmotszGkZf/wX8HKuHIUY6MtlkHfjMCp6x+3ap+b7lomDhlZm2kjtMlQIDAQAB'
# 支付宝公钥
PUBLIC_KEY = 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAigiw+lkJtd/QnP77ZMZhbT3BnG/LJWlkcEW2wOuKoh7DyXIRdoKZBKXZsoY12HeZ2a3HpUOTCI5nwEYUOShZ2Mv7y2zyfNWjFe1V8BC/loMSBCDnbkxAKA5CzDM11kuIV3SpBwj98UbzbFQSmwThQ6I9VY2gkCS+5PeBUFL3mKT91Zx8nOwoVewuD+9MAA0vScCw0juV+5nDdz+m9N5NZTXlBHcnUCwBEYtqc3ttAXssFo4gGX3Rz2oIVAhPRXmpYU+9KO+r5mc9hvotC11namkbA/4U0wI6IcwDR2E2krfx74U0vYP8IaXqCIOBFkUrYCl1vvWl3S4oj1YtkyNRzQIDAQAB'
# 私钥
PRIVATE_KEY = 'MIIEowIBAAKCAQEAhos5X4QkuPNVazwuWjvBtgdWAaauZ+jzAmB2w9ly+Uul+O3AMsmKuhx1fB3QkKJIh98yD0yMD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u4gdl/6oav1kcEBzRF72Gu6KJFjZ8oFyvfvnlj90z3DsAag2APDmCLFNEXHUdSsVQTRJ7ne4m8S0CgYBUe85ipCwIrZqOby/aJBqbJm4R3MI7RFPX6F+hm56VUdCB+N1H/wMVqwR9BeKde2xY+euQuTB8J6Tx7GONzUbS6ULoP8dQimnrs3v19/9Vw7N5G6SKroMQPvS7WPidV3OMwRzAqqC9Yn3PRelro+OsNMZ0O4qS3vpjPnsUXqts9QKBgAtZ1bJy6cYmFumC5Ux8+4dbTg0wKxmDknHLwbOzEOSaPIpHxUX21U+3YcLBeX1dIlZT+rA4ABayWKVgbvGKvxhz50c+SuEdZ3T4xmBC+ubbf4SwkfdxugCk5Td9xhXGDWJanvniWojunLJj5S/jM6LzaNBAa7GmSgQJmPBp4OQ5'

REDIRECT_URL = 'http://192.168.11.145:8000/third/zfb_callback'

LOGIN_URL = 'https://openauth.alipaydev.com/oauth2/appToAppAuth.htm'


# kgqtnd8177@sandbox.com

def get_alipay_client():
    alipay_client_config = AlipayClientConfig()
    alipay_client_config.server_url = GETWAT
    alipay_client_config.app_id = APPID
    alipay_client_config.app_private_key = PRIVATE_KEY
    alipay_client_config.alipay_public_key = PUBLIC_KEY
    # 使用授权码换取令牌
    alipay_client = DefaultAlipayClient(alipay_client_config)
    return alipay_client
